﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Gollie.Controls.BoundFields
{
	public class BoundFieldExpirationPeriod : BoundField
	{
		protected override string FormatDataValue(object dataValue, bool encode)
		{
			if (dataValue == null)
				return "";

			uint hours = Convert.ToUInt32(dataValue);
			TimeSpan expiresTs = new TimeSpan((int)hours, 0, 0);

			return ObjectFormatter.GetDurationString(expiresTs);
		}
	}
}